/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucue.ptc.gco.ui;

import edu.ucue.ptc.gco.mdl.Cargo;
import edu.ucue.ptc.gco.ngc.CargoManagerLocal;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;

/**
 *
 * @author Johnny
 */
@Named(value = "listaCargoAction")
@SessionScoped
public class ListaCargoAction implements Serializable {

    /**
     * Creates a new instance of ListaCargoAction
     */
    private List<Cargo> listaCargos;
    
    @Inject
    private CargoManagerLocal cargoManager;

    @PostConstruct
    public void init()
    {
        actualizar();
    }
    /**
     * @return the listaCargos
     */
    public List<Cargo> getListaCargos() {
        return listaCargos;
    }

    /**
     * @param listaCargos the listaCargos to set
     */
    public void setListaCargos(List<Cargo> listaCargos) {
        this.listaCargos = listaCargos;
    }
    
    public void actualizar()
    {
        setListaCargos(cargoManager.listarCargo());
    }
}
